package com.lsu.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lsu.app.bean.Course;
import com.lsu.app.bean.Kind;
import com.lsu.app.service.CourseService;
import com.lsu.app.mapper.CourseMapper;
import com.lsu.app.tool.AESUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

/**
 *
 * @description 针对表【course(课程)】的数据库操作Service实现
 * @Date 2023-10-18 20:26:04
 * @author hjj
 */
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService{
    private final CourseMapper mapper;

    public CourseServiceImpl(CourseMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public String getDirPathByCourseId(Integer id) {
        return mapper.getTeacherIdByCourseId(id)+"/"+id+"/";
    }

    @Override
    public Boolean existCourseByName(String name, Integer id) {
        return mapper.existCourseByName(name, id)!=0;
    }


    @Override
    public String getCourseNameById(Integer id) {
        return mapper.getCourseNameById(id);
    }


    @Override
    public void updateCourseProgress(Integer id,Integer amount) {
        mapper.updateCourseProgress(id,amount);
    }

    @Override
    public String getTeacherNameByTeacherId(Integer id) {
        return mapper.getTeacherNameByTeacherId(id);
    }

    @Override
    public void addClickById(Integer id) {
        mapper.addClickById(id);
    }

    @Override
    public void addClickByIdOfCount(Integer id, Integer count) {
        mapper.addClickByIdOf(id, count);
    }

    @Override
    public void updateHeatById(Integer id, Integer amount) {
        mapper.updateHeatById(id,amount);
    }

    @Override
    public Integer getTeacherIdByCourseId(Integer id) {
        return mapper.getTeacherIdByCourseId(id);
    }

    @Override
    public Integer getKindNameValueByKindName(String KindName) {
        Integer id = mapper.getKindNameValueByKindName(KindName);
        return id!=null?id:55;
    }



    @Override
    public List<Integer> getCourseIds() {
        return mapper.getCourseIds();
    }

    @Override
    public String getTeacherNameByCourseId(Integer id) {
        return mapper.getTeacherNameByCourseId(id);
    }

    @Override
    public List<Integer> getCourseIdsOfTeacherId(Integer teacherId) {
        return mapper.getCourseIdsOfTeacherId(teacherId);
    }

    @Override
    public Integer CountCourseNumByTeacherId(Integer teacherId) {
        return mapper.CountCourseNumByTeacherId(teacherId);
    }

    @Override
    public Integer CountClickByTeacherId(Integer teacherId) {
        return mapper.CountClickByTeacherId(teacherId);
    }

    @Override
    public List<Course> getCourseByTeacherId(Integer teacherId) {
        return mapper.getCourseByTeacherId(teacherId);
    }


}




